﻿@{
    ViewBag.Title = "ViewPage1";
    Layout = "~/Views/Shared/BaseView.cshtml";
}
<link href="/Content/style/main.css" rel="stylesheet" type="text/css" />
<div style="width: 100%;" align="center">
    <div style="width: 750px;">
        <div style="font-size: 20pt; width: 100%; text-align: center; padding-top: 20px;">
            交易数据周报</div>
        <div style="font-size: 16pt; width: 100%; text-align: right; padding-right: 10%;">
            ——@ViewBag.weekbegin.YPdate 年 @ViewBag.weekbegin.MPdate 月 @ViewBag.weekbegin.DPdate
            日-@ViewBag.weekend.YPdate 年 @ViewBag.weekend.MPdate 月 @ViewBag.weekend.DPdate 日</div>
        <div style="font-size: 12pt; width: 100%; text-align: left;">
            一、交易员收入分析</div>
        <div>
            @foreach (BenefitHelper.Data.Week.GroupWeekSum group in ViewBag.groupweeksums)
            {
                <div style="text-align: left;">
                    @group.Group.GroupName</div>
                <div style="text-align: left;">
                    <table cellspacing="0" cellpadding="0" class="list" style="width: 100%;">
                        <tr>
                            <td class="title" style="text-align: right;">
                                总收益额
                            </td>
                            <td class="title" style="text-align: right;">
                                总盈利
                            </td>
                            <td class="title" style="text-align: right;">
                                收益率
                            </td>
                            <td class="title" style="text-align: right;">
                                投资本金
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: right;">
                                @string.Format("{0:N2}", group.Profit)
                            </td>
                            <td style="text-align: right;">
                                @string.Format("{0:N2}", group.DayCount)
                            </td>
                            <td style="text-align: right;">
                                @string.Format("{0:N2}", group.Yield)
                            </td>
                            <td style="text-align: right;" class="leftyes">
                                @foreach (KeyValuePair<int, double> kvp in ViewBag.groupMoney)
                                {
                                    if (kvp.Key == group.GroupId)
                                    {
                                    <span>@string.Format("{0:N2}", kvp.Value)</span>
                                     break;
                                    }
                                }
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 10px;">
                                盈利(由大到小)
                            </td>
                            <td style="text-align: left;" colspan="3" class="leftyes">
                                @foreach (BenefitHelper.Sys.DayGroupOperators dgo in ViewBag.ogos)
                                {
                                    if (dgo.GroupId == group.GroupId)
                                    {
                                        foreach (BenefitHelper.View.OperatorWeekSum sum in ViewBag.operatorweeksums)
                                        {
                                            if (sum.OperatorId == dgo.OperatorId && sum.DayCount > 0)
                                            {
                                    <span style="padding-right: 10px;">@sum.Operator.UName</span>
                                            }
                                        }
                                    }
                                }
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 10px;" class="bottomyes">
                                亏损(由大到小)
                            </td>
                            <td style="text-align: left;" colspan="3" class="bottomyes leftyes">
                                @foreach (BenefitHelper.Sys.DayGroupOperators dgo in ViewBag.ogos)
                                {
                                    if (dgo.GroupId == group.GroupId)
                                    {
                                        foreach (BenefitHelper.View.OperatorWeekSum sum in ViewBag.operatorweeksums)
                                        {
                                            if (sum.OperatorId == dgo.OperatorId && sum.DayCount <= 0)
                                            {
                                    <span style="padding-right: 10px;">@sum.Operator.UName</span>
                                            }
                                        }
                                    }
                                }
                            </td>
                        </tr>
                    </table>
                </div>
            }
        </div>
        <div style="font-size: 12pt; width: 100%; text-align: left;">
            二、小组收入分析</div>
        <div>
            <div style="text-align: left;">
                <table cellspacing="0" cellpadding="0" class="list" style="width: 100%;" id="table1">
                    <tr>
                        <td class="title" style="text-align: left; padding-left: 10px; width: 10%;">
                            姓名
                        </td>
                        <td class="title" style="text-align: right;">
                            笔数
                        </td>
                        <td class="title" style="text-align: right;">
                            手续费
                        </td>
                        <td class="title" style="text-align: right;">
                            平仓盈亏
                        </td>
                        <td class="title" style="text-align: right;">
                            净盈利
                        </td>
                        <td class="title" style="text-align: right;">
                            均日盈利
                        </td>
                    </tr>
                    @{
                        double allbillcount = 0f;
                        double allfree = 0f;
                        double allprofit = 0f;
                        double alldaycount = 0f;
                    }
                    @foreach (BenefitHelper.Data.Week.GroupWeekSum group in ViewBag.groupweeksums)
                    {
                        <tr>
                            <td style="text-align: left; padding-left: 10px;">
                                @group.Group.GroupName
                            </td>
                            <td style="text-align: right;">
                                @group.BillCount
                            </td>
                            <td style="text-align: right;">
                                @string.Format("{0:N2}", group.Free)
                            </td>
                            <td style="text-align: right;">
                                @string.Format("{0:N2}", group.Profit)
                            </td>
                            <td style="text-align: right;">
                                @string.Format("{0:N2}", group.DayCount)
                            </td>
                            <td style="text-align: right;" class="leftyes">
                                @string.Format("{0:N2}", Math.Round(group.DayCount / 5, ViewBag.daytradeingcount))
                            </td>
                        </tr>
                        
                           allbillcount += group.BillCount;
                           allfree += group.Free;
                           allprofit += group.Profit;
                           alldaycount += group.DayCount;

                    }
                    <tr>
                        <td style="text-align: left; padding-left: 10px;" class="bottomyes">
                            合计
                        </td>
                        <td style="text-align: right;" class="bottomyes">
                            @allbillcount
                        </td>
                        <td style="text-align: right;" class="bottomyes">
                            @string.Format("{0:N2}", allfree)
                        </td>
                        <td style="text-align: right;" class="bottomyes">
                            @string.Format("{0:N2}", allprofit)
                        </td>
                        <td style="text-align: right;" class="bottomyes">
                            @string.Format("{0:N2}", alldaycount)
                        </td>
                        <td style="text-align: right;" class="bottomyes leftyes">
                            -
                        </td>
                    </tr>
                </table>
            </div>
            <div>
                <div>
                    <div style="width: 100%; height: 300px;" id="showflash2">
                    </div>
                </div>
                @* <div>
                    <img src="/Content/images/2.png" />
                </div>*@
            </div>
            <div style="height: 60px; line-height: 60px;">
                <p>
                </p>
            </div>
        </div>
    </div>
</div>
@MvcHtmlString.Create(ViewBag.billpic)
<script type="text/javascript">    ProductPie(); </script>
